<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>5分钟用Arthas定位Java线上故障 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
        }
        .article-title {
            font-family: 'Noto Serif SC', serif;
            font-weight: 700;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
        }
        .code-block {
            background-color: #1e293b;
            border-radius: 0.5rem;
            position: relative;
        }
        .code-toolbar {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        .code-block:hover .code-toolbar {
            opacity: 1;
        }
        .command-chip {
            background-color: #e2e8f0;
            color: #1e293b;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-family: monospace;
        }
        .section-card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .section-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .tip-card {
            border-left: 4px solid #3b82f6;
        }
        .warning-card {
            border-left: 4px solid #f59e0b;
        }
        .danger-card {
            border-left: 4px solid #ef4444;
        }
        .quote-mark {
            font-size: 5rem;
            line-height: 1;
            color: #e2e8f0;
            position: absolute;
            top: -1rem;
            left: -1.5rem;
        }
        .mermaid-container {
            background: white;
            padding: 2rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-6xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="article-title text-4xl md:text-5xl lg:text-6xl leading-tight mb-6">
                        5分钟用Arthas定位Java线上故障
                    </h1>
                    <p class="text-xl md:text-2xl text-blue-100 mb-8 max-w-xl">
                        阿里巴巴开源的Java诊断神器，让线上问题定位不再困难
                    </p>
                    <div class="flex items-center space-x-4">
                        <span class="px-4 py-2 bg-white text-blue-600 rounded-full font-medium">Java诊断</span>
                        <span class="px-4 py-2 bg-blue-700 text-white rounded-full font-medium">性能优化</span>
                        <span class="px-4 py-2 bg-blue-600 text-white rounded-full font-medium">线上排查</span>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1753169394715-e967f5ff-bf2c-4355-9383-7a5c6c692f1d.png" 
                         alt="Arthas诊断工具" 
                         class="rounded-lg shadow-xl w-full max-w-md border-4 border-white">
                </div>
            </div>
        </div>
    </div>

    <!-- Article Content -->
    <div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- Introduction -->
        <div class="mb-16 relative">
            <div class="quote-mark opacity-20">"</div>
            <p class="text-xl md:text-2xl text-gray-700 leading-relaxed mb-8 pl-10">
                凌晨三点，生产环境突然告警，系统响应缓慢，用户投诉不断。你是否曾经面对这样的场景却无从下手？传统的日志分析、远程调试往往耗时且效果有限。作为一名经历过无数次线上故障的Java工程师，我深知这种焦虑。
            </p>
            <p class="text-xl md:text-2xl text-gray-700 leading-relaxed mb-8">
                直到遇见Arthas，这个阿里巴巴开源的Java诊断工具，它让我能够在不重启应用、不修改代码的情况下，迅速定位线上问题。
            </p>
        </div>

        <!-- Table of Contents -->
        <div class="bg-white rounded-xl shadow-md p-6 mb-16 sticky top-4 z-10 border-l-4 border-blue-500">
            <h2 class="text-2xl font-bold mb-4 text-gray-800">文章目录</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                <a href="#section1" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>Arthas入门</span>
                </a>
                <a href="#section2" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>CPU飙升问题诊断</span>
                </a>
                <a href="#section3" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>内存泄漏与OOM问题排查</span>
                </a>
                <a href="#section4" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>接口性能问题定位</span>
                </a>
                <a href="#section5" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>类加载问题</span>
                </a>
                <a href="#section6" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>Arthas高级功能</span>
                </a>
                <a href="#section7" class="flex items-center text-blue-600 hover:text-blue-800">
                    <i class="fas fa-chevron-right mr-2 text-sm"></i>
                    <span>注意事项</span>
                </a>
            </div>
        </div>

        <!-- Section 1 -->
        <section id="section1" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">1</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">Arthas入门</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-question-circle text-blue-500 mr-2"></i>
                        Arthas是什么
                    </h3>
                    <p class="text-gray-700 mb-4">
                        Arthas是阿里巴巴开源的一款Java诊断工具，专为线上问题定位而生。它支持JVM多版本，能够在不中断服务的情况下，实时分析和诊断Java应用的各种疑难杂症。
                    </p>
                    <p class="text-gray-700">
                        无论是CPU飙升、内存泄漏，还是类加载、方法调用异常，Arthas都能帮你一网打尽。
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-download text-blue-500 mr-2"></i>
                        安装与启动
                    </h3>
                    <p class="text-gray-700 mb-4">
                        在Windows平台下，安装Arthas非常简单。只需下载<code class="bg-gray-100 px-2 py-1 rounded">arthas-boot.jar</code>，然后在命令行中执行：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>java -jar arthas-boot.jar</code></pre>
                    </div>
                    <p class="text-gray-700">
                        Arthas会自动扫描当前机器上所有的Java进程，并列出进程ID（PID）供你选择。
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6 md:col-span-2">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-plug text-blue-500 mr-2"></i>
                        连接目标进程
                    </h3>
                    <p class="text-gray-700 mb-4">
                        假设你的应用进程PID为12345，输入对应数字即可连接：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>请选择需要连接的Java进程，输入序号：
* [1]:12345  com.ts.demo.Application</code></pre>
                    </div>
                    <p class="text-gray-700">
                        连接成功后，屏幕会出现<code class="command-chip">ts></code>提示符，表示你已进入Arthas命令行模式。
                    </p>
                </div>
            </div>
        </section>

        <!-- Section 2 -->
        <section id="section2" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">2</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">CPU飙升问题诊断实战</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md p-6 mb-8">
                <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-tachometer-alt text-blue-500 mr-2"></i>
                    使用dashboard命令监控系统整体状态
                </h3>
                <p class="text-gray-700 mb-4">
                    凌晨CPU飙升，第一步当然是看整体情况：
                </p>
                <div class="code-block rounded-lg overflow-hidden mb-4">
                    <div class="code-toolbar flex space-x-2">
                        <button class="text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> dashboard</code></pre>
                </div>
                <p class="text-gray-700">
                    该命令会实时展示CPU、内存、GC等关键指标，帮助你快速锁定异常。
                </p>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-threads text-blue-500 mr-2"></i>
                        thread命令定位高CPU线程
                    </h3>
                    <p class="text-gray-700 mb-4">
                        发现CPU占用高，继续用<code class="command-chip">thread</code>命令找出"元凶"：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> thread -n 5</code></pre>
                    </div>
                    <p class="text-gray-700">
                        此命令会列出CPU占用最高的前5个线程，并显示其ID。
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-layer-group text-blue-500 mr-2"></i>
                        jstack分析线程堆栈
                    </h3>
                    <p class="text-gray-700 mb-4">
                        拿到线程ID后，进一步分析堆栈：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> thread 123</code></pre>
                    </div>
                    <p class="text-gray-700">
                        你会看到类似如下的堆栈信息：
                    </p>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-md p-6 mb-8 overflow-hidden">
                <div class="code-block rounded-lg">
                    <div class="code-toolbar flex space-x-2">
                        <button class="text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <pre class="text-gray-200 p-4 overflow-x-auto"><code>"main" Id=123 RUNNABLE
    at com.ts.service.CacheService.get(CacheService.java:45)
    at com.ts.controller.UserController.query(UserController.java:30)
    // ... 省略部分堆栈 ...</code></pre>
                </div>
            </div>

            <div class="tip-card bg-blue-50 rounded-xl shadow-md p-6">
                <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-lightbulb text-blue-500 mr-2"></i>
                    实战案例：死循环导致的CPU 100%问题排查
                </h3>
                <p class="text-gray-700">
                    某次线上故障，发现<code class="bg-blue-100 px-1 py-0.5 rounded">CacheService.get</code>方法反复调用，原来是缓存失效后进入了死循环。通过Arthas，5分钟内就定位到了问题代码，避免了更大损失。
                </p>
            </div>
        </section>

        <!-- Section 3 -->
        <section id="section3" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">3</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">内存泄漏与OOM问题排查</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-database text-blue-500 mr-2"></i>
                        使用heapdump命令导出堆内存
                    </h3>
                    <p class="text-gray-700 mb-4">
                        内存飙升或OOM时，先导出堆内存：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> heapdump /tmp/heapdump.hprof</code></pre>
                    </div>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-memory text-blue-500 mr-2"></i>
                        memory命令分析内存使用情况
                    </h3>
                    <p class="text-gray-700 mb-4">
                        快速查看内存分布：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> memory</code></pre>
                    </div>
                    <p class="text-gray-700">
                        会显示堆内存、非堆内存、GC等信息。
                    </p>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-md p-6 mb-8">
                <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-search text-blue-500 mr-2"></i>
                    使用MAT工具进一步分析堆转储文件
                </h3>
                <p class="text-gray-700">
                    将<code class="command-chip">heapdump.hprof</code>下载到本地，用Eclipse MAT分析，找出大对象和泄漏路径。
                </p>
            </div>

            <div class="warning-card bg-yellow-50 rounded-xl shadow-md p-6">
                <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-exclamation-triangle text-yellow-500 mr-2"></i>
                    实战案例：缓存设计不当导致的OOM问题
                </h3>
                <p class="text-gray-700">
                    某次OOM，发现<code class="bg-yellow-100 px-1 py-0.5 rounded">ConcurrentHashMap&lt;String, Object&gt;</code>无限增长，原来是缓存未设置过期时间。通过Arthas和MAT，迅速定位并修复。
                </p>
            </div>
        </section>

        <!-- Section 4 -->
        <section id="section4" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">4</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">接口性能问题定位</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-project-diagram text-blue-500 mr-2"></i>
                        trace命令追踪方法调用链路
                    </h3>
                    <p class="text-gray-700 mb-4">
                        接口慢？用<code class="command-chip">trace</code>命令看看方法调用耗时：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> trace com.ts.service.OrderService placeOrder</code></pre>
                    </div>
                    <p class="text-gray-700">
                        输出如下：
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-chart-line text-blue-500 mr-2"></i>
                        monitor命令监控方法执行情况
                    </h3>
                    <p class="text-gray-700 mb-4">
                        持续监控某方法的执行统计：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> monitor com.ts.service.OrderService placeOrder</code></pre>
                    </div>
                    <p class="text-gray-700">
                        每隔几秒输出一次调用次数、平均耗时等信息。
                    </p>
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-md p-6 mb-8 overflow-hidden">
                <div class="code-block rounded-lg">
                    <div class="code-toolbar flex space-x-2">
                        <button class="text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <pre class="text-gray-200 p-4 overflow-x-auto"><code>`---ts.service.OrderService.placeOrder() #cost: 150ms
    `---ts.dao.OrderDao.save() #cost: 120ms</code></pre>
                </div>
            </div>
        </section>

        <!-- Section 5 -->
        <section id="section5" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">5</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">类加载问题</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-cubes text-blue-500 mr-2"></i>
                        classloader命令分析类加载情况
                    </h3>
                    <p class="text-gray-700 mb-4">
                        类冲突、NoClassDefFoundError？用<code class="command-chip">classloader</code>命令：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> classloader</code></pre>
                    </div>
                    <p class="text-gray-700">
                        可以查看所有ClassLoader及其加载的类。
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-code text-blue-500 mr-2"></i>
                        jad命令反编译线上代码
                    </h3>
                    <p class="text-gray-700 mb-4">
                        想看线上实际运行的代码？用<code class="command-chip">jad</code>命令：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> jad com.ts.service.OrderService</code></pre>
                    </div>
                    <p class="text-gray-700">
                        会输出反编译后的源码，方便比对和排查。
                    </p>
                </div>
            </div>

            <div class="danger-card bg-red-50 rounded-xl shadow-md p-6">
                <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-fire text-red-500 mr-2"></i>
                    redefine命令实现热修复
                </h3>
                <p class="text-gray-700 mb-4">
                    紧急修复bug？用<code class="command-chip">redefine</code>命令热加载新class文件，无需重启：
                </p>
                <div class="code-block rounded-lg overflow-hidden mb-4">
                    <div class="code-toolbar flex space-x-2">
                        <button class="text-gray-300 hover:text-white">
                            <i class="far fa-copy"></i>
                        </button>
                    </div>
                    <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> redefine /tmp/OrderService.class</code></pre>
                </div>
                <p class="text-gray-700">
                    <strong class="text-red-600">警告：</strong>此操作有一定风险，请确保新class文件与旧版本兼容。
                </p>
            </div>
        </section>

        <!-- Section 6 -->
        <section id="section6" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">6</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">Arthas高级功能</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-terminal text-blue-500 mr-2"></i>
                        ognl命令执行表达式获取运行时数据
                    </h3>
                    <p class="text-gray-700 mb-4">
                        直接获取运行时变量：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> ognl '@com.ts.util.Config@INSTANCE.get("timeout")'</code></pre>
                    </div>
                    <p class="text-gray-700">
                        非常适合获取Spring容器中的Bean或静态变量。
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-eye text-blue-500 mr-2"></i>
                        watch/tt命令监控方法入参与返回值
                    </h3>
                    <p class="text-gray-700 mb-4">
                        监控方法参数和返回值：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> watch com.ts.service.UserService getUser '{params, returnObj}' -x 2</code></pre>
                    </div>
                    <p class="text-gray-700">
                        可以实时观察方法的输入输出，调试神器！
                    </p>
                </div>

                <div class="section-card bg-white rounded-xl shadow-md p-6 md:col-span-2">
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-chart-pie text-blue-500 mr-2"></i>
                        profiler命令生成火焰图分析性能瓶颈
                    </h3>
                    <p class="text-gray-700 mb-4">
                        性能瓶颈分析神器：
                    </p>
                    <div class="code-block rounded-lg overflow-hidden mb-4">
                        <div class="code-toolbar flex space-x-2">
                            <button class="text-gray-300 hover:text-white">
                                <i class="far fa-copy"></i>
                            </button>
                        </div>
                        <pre class="text-gray-200 p-4 overflow-x-auto"><code>ts> profiler start
// 运行一段时间后
ts> profiler stop</code></pre>
                    </div>
                    <p class="text-gray-700">
                        生成火焰图文件，下载后用浏览器打开即可直观看到CPU时间分布。
                    </p>
                </div>
            </div>

            <!-- Mermaid Diagram -->
            <div class="mermaid-container">
                <div class="mermaid">
                    graph TD
                        A[Arthas核心功能] --> B[诊断CPU问题]
                        A --> C[诊断内存问题]
                        A --> D[诊断性能问题]
                        A --> E[诊断类加载问题]
                        
                        B --> B1[dashboard]
                        B --> B2[thread]
                        B --> B3[thread -n 5]
                        
                        C --> C1[heapdump]
                        C --> C2[memory]
                        C --> C3[MAT分析]
                        
                        D --> D1[trace]
                        D --> D2[monitor]
                        D --> D3[watch]
                        D --> D4[profiler]
                        
                        E --> E1[classloader]
                        E --> E2[jad]
                        E --> E3[redefine]
                </div>
            </div>
        </section>

        <!-- Section 7 -->
        <section id="section7" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <span class="text-blue-600 text-2xl font-bold">7</span>
                </div>
                <h2 class="article-title text-3xl font-bold text-gray-800">Arthas注意事项</h2>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
                <div class="bg-white rounded-xl shadow-md p-6 border-t-4 border-green-500">
                    <h3 class="text-lg font-bold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-shield-alt text-green-500 mr-2"></i>
                        生产环境安全措施
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            建议只在内网环境使用
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            使用白名单限制可执行命令
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            及时断开连接，避免资源占用
                        </li>
                    </ul>
                </div>

                <div class="bg-white rounded-xl shadow-md p-6 border-t-4 border-purple-500">
                    <h3 class="text-lg font-bold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-handshake text-purple-500 mr-2"></i>
                        与APM工具协同使用
                    </h3>
                    <p class="text-gray-700">
                        Arthas适合临时排查，APM适合长期监控。两者结合，事半功倍。
                    </p>
                </div>

                <div class="bg-white rounded-xl shadow-md p-6 border-t-4 border-orange-500">
                    <h3 class="text-lg font-bold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-exclamation-triangle text-orange-500 mr-2"></i>
                        常见陷阱与避坑指南
                    </h3>
                    <ul class="text-gray-700 space-y-2">
                        <li class="flex items-start">
                            <i class="fas fa-times-circle text-orange-500 mt-1 mr-2"></i>
                            不要在高并发场景下频繁执行重操作命令
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-times-circle text-orange-500 mt-1 mr-2"></i>
                            注意命令参数，避免误操作
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-times-circle text-orange-500 mt-1 mr-2"></i>
                            及时清理生成的临时文件
                        </li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- Conclusion -->
        <div class="bg-white rounded-xl shadow-md p-8 text-center">
            <h2 class="article-title text-3xl font-bold text-gray-800 mb-6">掌握Arthas，让线上问题无处遁形</h2>
            <p class="text-xl text-gray-700 mb-6 max-w-2xl mx-auto leading-relaxed">
                从CPU飙升到内存泄漏，从接口性能到类加载问题，Arthas为你提供了全方位的诊断方案。通过本文介绍的核心命令和实战案例，相信你已经掌握了快速定位线上问题的关键技能。
            </p>
            <p class="text-xl text-gray-700 max-w-2xl mx-auto leading-relaxed">
                下次再遇生产告警，不妨尝试使用Arthas，体验"5分钟定位问题"的高效与畅快！
            </p>
        </div>
    </div>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>